<!doctype html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Button控制舵机</title>
        <script src="./index.js"></script>
    </head>

    <body>
        <div>
            <span>Button控制Light</span>
        </div>

        <script>
            function LightReceive() {
                ButtonPanel.onReceive((res) => {
                    console.log(res.buttonNumber, 'res.buttonNumber');
                    if (res.buttonNumber > 4) {
                        MatrixLight.setSwitch(true);
                    } else {
                        MatrixLight.setSwitch(false);
                    }
                });
            }
            // 初始化实时接受按钮上报
            LightReceive();
        </script>
    </body>
</html>
